package com.exadel.googleregistrator.controllers;

import com.exadel.googleregistrator.GoogleAccounter;
import com.exadel.googleregistrator.voicemail.K7Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created with IntelliJ IDEA.
 * User: Администратор
 * Date: 21.08.12
 * Time: 12:45
 */
@Controller
@RequestMapping("/index")
public class RegistrationController {

    @Autowired
    private GoogleAccounter accounter;
    @Autowired
    K7Controller phoneAccounter;

    @RequestMapping(method = RequestMethod.GET)
    public String showCaptcha(ModelMap model){
        model.addAttribute("captchaUrl", accounter.getCaptcha());
        return "index";
    }

    @RequestMapping(method = RequestMethod.POST)
    public String refreshCaptcha(ModelMap model){
        model.addAttribute("captchaUrl", accounter.refreshCaptcha());
        return "index";
    }

  /*  @RequestMapping(method = RequestMethod.POST, params = "submit")
    public String createAcoount( ModelMap model){
        String captcha = form.getCaptcha();
        System.out.println(captcha);
        accounter.createAccount(captcha);
        return "index";
    }*/

}
